package com.reading.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.reading.mapper.BannerMapper;
import com.reading.pojo.web.Banner;
import com.reading.service.BannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BannerServiceImpl implements BannerService {
    @Autowired
    private BannerMapper bannerMapper;
    @Override
    public PageInfo findbanner(Banner banner, Integer pageNo, Integer pageSize) {
        PageHelper.startPage(pageNo,pageSize);
        List<Banner> list = bannerMapper.findbanner(banner);
        PageInfo pageInfo = PageInfo.of(list);
        return pageInfo;
    }

    @Override
    public List<Banner> list() {
        return bannerMapper.list();
    }

    @Override
    public void add(Banner banner) {
        bannerMapper.add(banner);
    }

    @Override
    public void update(Banner banner) {
        bannerMapper.update(banner);
    }

    @Override
    public void delete(Integer id) {
        bannerMapper.delete(id);
    }

}
